#region (c) 2014 THN Solutions LLC. - All rights reserved
/*
THN WEB SERVER

Copyright (c) 2014, THN Solutions LLC. ( www.ThnSolutions.com )
Author: Nguyễn, M. Hải                 ( www.Minh-Hai.com     )
All rights reserved.

This library is dual-licensed.
  + For use in commercial software, please obtain a commercial license from THN Solutions LLC.    

  + For use in free software, this library is licensed under GPL version 3. A summary of 
	GPLv3 is listed below. You should also find a copy of GPLv3 as file License_GPLv3.txt 
	included with the source-code files.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 3 as published by
    the Free Software Foundation  of the License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#endregion

#region Record of Change
//             							CHANGE HISTORY
// -------------------------------------------------------------------------------------
// |   DATE    | DEVELOPER  | DESCRIPTION                                              |
// -------------------------------------------------------------------------------------
// | 05-Sep-12 | HaiNM      | First creation.                                          |
// -------------------------------------------------------------------------------------
//
#endregion

#region Record of Audit
//             							REVIEW HISTORY
// -------------------------------------------------------------------------------------
// |   DATE    | REVIEWER   | NOTES                                                    |
// -------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------
//
#endregion

#region Using directives
using System;

using Thn;
#endregion

namespace Thn.Web
{
    /// <summary>
    /// A file manager is responsible for reading file
    /// </summary>
#if DEBUG || TESTING
    public
#else
    public
#endif
 interface IFileManager
    {
        #region Exists
        /// <summary>
        /// Checks whether the provided URI has an existing content.
        /// </summary>
        bool Exists(string uri);
        #endregion

        #region Read
        /// <summary>
        /// Attempt to reads a number of bytes into the provided buffer.
        /// </summary>
        /// <param name="uri">Unique URI of the file to read.</param>
        /// <param name="offset">Zero-based index of the starting offset from the beginning of file.</param>
        /// <param name="count">Number of bytes to read.</param>
        /// <param name="buffer">The buffer to store results in.</param>
        /// <returns>Actual number of bytes read.</returns>
        int Read(string uri, byte[] buffer, long offset, int count);
        #endregion

        #region Complete
        /// <summary>
        /// Notify that a content is no longer required.
        /// Serving threads should call this method after it has completed processing so that the manager has a chance to
        /// clean up the cache used for the content.
        /// </summary>
        void Complete(string uri);
        #endregion

        #region Get Size
        /// <summary>
        /// Gets size of a content in bytes.
        /// </summary>
        long GetSize(string uri);
        #endregion
    }
}
